package com.cs.flyweight;

import java.util.HashMap;

/**
 * @author Sam.Lee E-mail:lishanman2007@163.com
 * @version Created：Aug 29, 2011 10:06:54 AM
 */
public class FlyweightFactory {
	private static HashMap<String, Artist> pool = new HashMap<String, Artist>();

	public static Artist getArtist(String key) {
		Artist artist = pool.get(key);
		if (artist == null) {
			artist = new Artist(key);
			pool.put(key, artist);
			System.out.println("这是新创建的artist...");
		} else {
			System.out.println("这是从pool池中拿出的artist...");
		}
		return artist;
	}
}
